# Load clip data SF3B1 WTclipFilesWt ="/Users/mirko/Projects/sf3b1/01_data_subsamp/wt/cov/replicate"clipFiles =c(clipFilesWt)clipFiles =list.files(clipFiles, pattern =".bw$", full.names =TRUE)clipFilesP = clipFiles[grep(clipFiles, pattern ="Plus")]clipFilesM = clipFiles[grep(clipFiles, pattern ="Minus")]# Organize clip data in dataframecolData =data.frame(id =1:3,condition =factor(c("WT", "WT", "WT")),clPlus = clipFilesP,clMinus = clipFilesM)bdsSF3B1_WT =BSFDataSetFromBigWig(ranges = rngEnd, meta = colData)# Load clip data SF3B1 MUTclipFilesMut ="/Users/mirko/Projects/sf3b1/01_data_subsamp/mut/cov/replicate"clipFiles =c(clipFilesMut)clipFiles =list.files(clipFiles, pattern =".bw$", full.names =TRUE)clipFilesP = clipFiles[grep(clipFiles, pattern ="Plus")]clipFilesM = clipFiles[grep(clipFiles, pattern ="Minus")]# Organize clip data in dataframecolData =data.frame(id =1:2,condition =factor(c("MUT", "MUT")),clPlus = clipFilesP,clMinus = clipFilesM)bdsSF3B1_MUT =BSFDataSetFromBigWig(ranges = rngEnd, meta = colData)# Load clip data U2AF65 WTclipFilesWt ="/Users/mirko/Projects/BindingSiteStrength/01_data/05_U2AF65_cellLines/K562/cov/replicates/"clipFiles =c(clipFilesWt)clipFiles =list.files(clipFiles, pattern =".bw$", full.names =TRUE)clipFilesP = clipFiles[grep(clipFiles, pattern ="plus")]clipFilesM = clipFiles[grep(clipFiles, pattern ="minus")]# Organize clip data in dataframecolData =data.frame(id =1:4,condition =factor(rep("WT",4)),clPlus = clipFilesP,clMinus = clipFilesM)# creating objects and importing clip siganlbdsU2AF2_WT =BSFDataSetFromBigWig(ranges = rngEnd, meta = colData)# Load eclip data SF3B1 WTclipFilesWt ="/Users/mirko/Projects/sf3b1/04_eCLIP/sf3b1/"clipFiles =c(clipFilesWt)clipFiles =list.files(clipFiles, pattern =".bw$", full.names =TRUE)clipFilesP = clipFiles[grep(clipFiles, pattern ="plus")]clipFilesM = clipFiles[grep(clipFiles, pattern ="minus")]# Organize clip data in dataframecolData =data.frame(id =1:2,condition =factor(rep("WT",2)),clPlus = clipFilesP,clMinus = clipFilesM)# creating objects and importing clip siganlbdsSF3B1_ECLIP =BSFDataSetFromBigWig(ranges = rngEnd, meta = colData)clipData =list(bdsSF3B1_WT = bdsSF3B1_WT, bdsSF3B1_MUT = bdsSF3B1_MUT, bdsU2AF2_WT = bdsU2AF2_WT,bdsSF3B1_ECLIP = bdsSF3B1_ECLIP)
For meta profiles iCLIP crosslinks are aligned at the canonical and alternative splice sites, in a symmetrical 200nt wide window. From all events (#N=7,951), only those with a distance from 0-100nt are shown (#N=4,478). Note that for each plot all events with zero crosslinks are also removed. The final number of ranges used is indicated above each plot.
3.1 Single heatmaps
Show code
makeHmMatrixList <-function(clipSet, plot.topLim.size =1){### --------------------------------------------------------------------------### Ranges### --------------------------------------------------------------------------# select ranges# -> select within 100nt distance rngEndCurr = rngEnd rngAltCurr = rngAlt rngEndCurr = rngEnd[rngEnd$distAltEnd <=100] rngAltCurr = rngAlt[rngAlt$distAltEnd <=100]# shuffle ranges around# -> to avoid auto sorting by P valueset.seed(1234) reorderIdx =sample(1:length(rngEndCurr)) rngEndCurr = rngEndCurr[reorderIdx,] rngAltCurr = rngAltCurr[reorderIdx,]### --------------------------------------------------------------------------### Coverage### --------------------------------------------------------------------------# coverage 3'AS outer position bdsSel =setRanges(clipSet, resize(rngEndCurr, fix ="end", width =1) +200) cov1 =coverageOverRanges(bdsSel, returnOptions ="merge_all_replicates", method ="mean") m1 = cov1# coverage 3'AS inner position bdsSel =setRanges(clipSet, resize(rngAltCurr, fix ="end", width =1) +200) cov2 =coverageOverRanges(bdsSel, returnOptions ="merge_all_replicates", method ="mean") m2 = cov2# sorting by distance to 3'AS distIdx =order(rngEndCurr$distAltEnd, decreasing =FALSE) m1 = m1[distIdx,] m2 = m2[distIdx,]# remove rows with no signal m1 = m1[rowSums(m1) >0,] m2 = m2[rowSums(m2) >0,]# scale values in matrix for plotting m1 =minMaxNorm(m1) m2 =minMaxNorm(m2) m1 =t(apply(m1, 1, smoothing, lambda=0.05, dim=401)) m2 =t(apply(m2, 1, smoothing, lambda=0.05, dim=401))# combine matrices keep =intersect(rownames(m1), rownames(m2)) m1 = m1[rownames(m1) %in% keep,] m2 = m2[rownames(m2) %in% keep,]### --------------------------------------------------------------------------### Annotations### --------------------------------------------------------------------------# set reference range for annotations range = rngEndCurr currM = m1# annotate with distance between alternative and constitutive 3'ss dfDist =data.frame(dist = range$distAltEnd[as.numeric(rownames(currM))]) dfDist$dist[dfDist$dist >100] =100 haDist =rowAnnotation(dist =anno_points(dfDist, size =unit(2, "points"), gp =gpar(col ="#595959")),width =unit(1, "cm"), annotation_name_gp =gpar(fontsize =6) )# annotate with dPSI/ PSI values df =data.frame(deltaPSI = range$deltaPSI[as.numeric(rownames(currM))]) haDeltaPSI =rowAnnotation(deltaPSI =anno_points(df, size =unit(2, "points"), gp =gpar(col ="#4c435a", alpha =1), ylim =c(-1,1) ), width =unit(2, "cm"), annotation_name_gp =gpar(fontsize =6) ) df =data.frame(psiWT = range$wtPSI[as.numeric(rownames(currM))]) haWtPSI =rowAnnotation(psiWT =anno_points(df, size =unit(2, "points"), gp =gpar(col ="#0086b3", alpha =0.5)), # , ylim = c(-1,0)width =unit(2, "cm"), annotation_name_gp =gpar(fontsize =6) ) df =data.frame(psiMUT = range$mutPSI[as.numeric(rownames(currM))]) haMutPSI =rowAnnotation(psiMUT =anno_points(df, size =unit(2, "points"), gp =gpar(col ="#990000", alpha =0.5)), # , ylim = c(-1,0)width =unit(2, "cm"), annotation_name_gp =gpar(fontsize =6) )# annotate with significant results sig = range$sig[as.numeric(rownames(currM))] haSig =rowAnnotation(sigRes = sig, col =list(sigRes =c("FALSE"="white", "TRUE"="black")),gp =gpar(lwd =0.1),show_annotation_name=F, annotation_name_gp =gpar(fontsize =6),annotation_legend_param =list(sigRes =list(nrow =1, direction ="horizontal")) )# split by range split =factor(ifelse(dfDist$dist >=12& dfDist$dist <=21, "2",ifelse(dfDist$dist <=12& dfDist$dist <=21, "1", "3")),levels =c("1", "2", "3"))### --------------------------------------------------------------------------### Plotting### --------------------------------------------------------------------------# use raw-data for barplot on top mm1 = cov1[rownames(cov1) %in%rownames(m1),] mm2 = cov2[rownames(cov2) %in%rownames(m2),] mm1 = mm1[,c(30:250)] mm2 = mm2[,c(100:320)]# formatting of matrix outlinerownames(m1) =NULLcolnames(m1) =-200:200colnames(m1)[as.numeric(colnames(m1)) %%100!=0] =""rownames(m2) =NULLcolnames(m2) =-200:200colnames(m2)[as.numeric(colnames(m2)) %%100!=0] =""# change heatmap plotting frame m1 = m1[,c(30:250)] m2 = m2[,c(100:320)]# annotate with top col means profile df1 =data.frame(sums =colMeans(mm1)) haMeans1 =HeatmapAnnotation(cov =anno_barplot(df1, gp =gpar(fill ="#595959", col ="#595959"), ylim =c(0, plot.topLim.size)),height =unit(2, "cm"), show_annotation_name=F, annotation_name_gp =gpar(fontsize =6)) df2 =data.frame(sums =colMeans(mm2)) haMeans2 =HeatmapAnnotation(cov =anno_barplot(df2, gp =gpar(fill ="#595959", col ="#595959"), ylim =c(0, plot.topLim.size)),height =unit(2, "cm"), show_annotation_name=F, annotation_name_gp =gpar(fontsize =6))# color scale custom.col =colorRamp2(c(0,0.05,0.1,0.15,0.2,0.25), viridis(6, option ="mako", direction =-1))# plot heatmap h1 =Heatmap(m1,column_title ="3'AS outer", name ="iCLIP signal",cluster_rows =FALSE, cluster_columns =FALSE,show_column_names =TRUE, show_row_names =FALSE,col = custom.col,row_split = split, row_gap =unit(0.1, "cm"),column_names_gp =gpar(fontsize =8),top_annotation = haMeans1,right_annotation =c(haSig, haDeltaPSI, haWtPSI, haMutPSI),border =TRUE,use_raster =TRUE, raster_by_magick =TRUE,raster_magick_filter ="Spline",raster_quality =1, raster_resize_mat = mean,heatmap_legend_param =list(legend_width =unit(6, "cm"),title_position ="topleft", direction ="horizontal" ) ) h2 =Heatmap(m2,column_title ="3'AS inner", name ="iCLIP signal",cluster_rows =FALSE, cluster_columns =FALSE,show_column_names =TRUE, show_row_names =FALSE,col = custom.col,row_split = split, row_gap =unit(0.1, "cm"),top_annotation = haMeans2,left_annotation =c(haDist),column_names_gp =gpar(fontsize =8),border =TRUE,use_raster =TRUE, raster_by_magick =TRUE,raster_magick_filter ="Spline",raster_quality =1, raster_resize_mat = mean,heatmap_legend_param =list(legend_width =unit(6, "cm"),title_position ="topleft", direction ="horizontal" ) ) plotList = h2 + h1 matDim =dim(m1) l =list(plotList = plotList, matDim = matDim)return(l)}
Splicing heatmaps of SF3B1 and U2AF2 at splice sites
4 PSI distance plots
The following plots show at which distances the canonical splice sites is preferred over the alternative and vice versa. For the zoom out version usage fraction per distance is computed as a rolling mean over 20nt. For the zoom in fractions are shown on a per nt level.